<template>
	<view class="activity">
		<view class="item" @click="toDetail(item.id)" v-for="(item,index) in list" :key="index">
			<image :src="host+item.pic" class="img" mode="widthFix"></image>
			<view class="content">
				<text>{{item.title}}</text>
				<text class="time">{{item.createTime}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	import fetch from '@/common/fetch.js'
	export default{
		data(){
			return{
				list:[]
			}
		},
		computed:{
			host(){
				return fetch.interfaceUrl()
			}
		},
		mounted(){
			this.getList(22)
		},
		methods:{
			toDetail(id){
				uni.navigateTo({
					url:'./detail?id='+id
				})
			},
			getList(type){
				fetch.request('/index/mobile/articleListByCatid',{id:type},'GET').then(res=>{
					let {data} = res
					this.list = data
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	page,.activity{
		width: 100%;
		min-height: 100%;
	}
	.activity{
		padding: 20rpx 30rpx;
		box-sizing: border-box;
	}
	.item{
		background: #fff;
		border-radius: 20rpx;
		margin-bottom: 40rpx;
		.img{
			width: 100%;
			border-radius: 20rpx;
		}
		.content{
			padding: 20rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			color: #8798a3;
			font-size: 16px;
			.time{
				font-size: 12px;
				color: #aaa;
				margin-top: 20rpx;
			}
		}
	}
</style>
